package btp.SuryaSiddhanta.Trigonometry;

public class Sine {
	static double [] hinduSines = {0, 225, 449, 671, 890, 1105, 1315, 1520, 1719, 1910, 2093, 2267, 2431, 2585, 2728, 2859, 2978, 3084, 3177, 3256, 3321, 3372, 3409, 3431, 3438};

	public static double sine(double angle)
	{
		angle = angle%90;
		angle = angle/3.75;
		int integer = (int) Math.floor(angle); 
		return hinduSines[integer] + (angle-integer)*(hinduSines[integer+1]-hinduSines[integer]);
	}

	
	public static double arcsine(double sine){
		int integer = -1;
		for(int i=0; i<hinduSines.length; i++)
			if(hinduSines[i]<=sine)
				integer++;
			else
				break;
		return (integer + (sine-hinduSines[integer])/(hinduSines[integer+1]-hinduSines[integer]))*3.75;
	}
}
